#pragma once

#include "CoreCommon.h"
#include "MathCommon.h"

LOCO_BEGIN


/// This struct is a POD
struct LOCO_CORE_API Vector3
{
	// Attributes
	float x, y, z;

	// Static constants
	static const Vector3 zero;
	static const Vector3 unit_x;
	static const Vector3 unit_y;
	static const Vector3 unit_z;
	static const Vector3 one;

	// Methods
	Vector3() = default;
	Vector3(Vector3 const& in) = default;
	Vector3(float x_val, float y_val, float z_val);
	Vector3(float value);

	Vector3 operator-() const;
	Vector3 operator+(Vector3 const& in) const;
	Vector3 operator-(Vector3 const& in) const;
	Vector3 operator*(Vector3 const& in) const;
	Vector3 operator/(Vector3 const& in) const;

	Vector3& operator+=(Vector3 const& in);
	Vector3& operator-=(Vector3 const& in);
	Vector3& operator*=(Vector3 const& in);
	Vector3& operator/=(Vector3 const& in);

	bool operator==(Vector3 const& in) const;
	bool operator!=(Vector3 const& in) const;
	bool operator>(Vector3 const& in) const;
	bool operator<(Vector3 const& in) const;
	bool operator>=(Vector3 const& in) const;
	bool operator<=(Vector3 const& in) const;

	float norm() const;
	float square_norm() const;
	Vector3 normalize() const;

	static bool near_equal(Vector3 const& a, Vector3 const& b, float delta = DELTA);
	static Vector3 reflection(Vector3 const& in, Vector3 const& normal);
	static float distance(Vector3 const& a, Vector3 const& b);
	static float square_distance(Vector3 const& a, Vector3 const& b);
	static float dot(Vector3 const& a, Vector3 const& b);
	static Vector3 cross(Vector3 const& a, Vector3 const& b);
	static Vector3 lerp(Vector3 const& a, Vector3 const& b, float value);
	static Vector3 lerp(Vector3 const& a, Vector3 const& b, Vector3 const& value);
};

// inline defintions
#include "Vector3.inl"

LOCO_END


